import socket
import threading
class Atalk():
    def __init__(self):
        self.A = socket.socket()


    def connect(self,host,port):
        address = (host,port)
        self.A.connect(adderess)

        threading.Thread(target=self.send).start()
        threading.Thread(target=self.receive).start()


    def send(self):
        while 1:
            to_msg = input('>>>')
            self.A.send(to_msg.encode('utf-8'))
            if to_msg == 'bye':
                break


    def receive(self):
        while 1:
            from_mag = self.A.recv(1024).decode('utf-8')
            print(from_mag)
            pass


    def __del__(self):
        self.A.close()


if __name__ == '__main__':
    a = Atalk()
    a.connect('10.10.10.60',7800)
